<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>倒计时跳转</title>
</head>
<body>
    <p><span class="time">5</span>秒后跳转到360</p>
    <script>
        (function(){
            var timediv = document.querySelector(".time"),
                time = timediv.innerHTML,
                timeoutId = setInterval(
                    function(){
                        --time;
                        if(time == 0) {
                            clearInterval(timeoutId);    
                            location.href="https://www.so.com";
                        }
                        timediv.innerHTML = time;
                    }, 1000);
        }())
    </script>
</body>
</html>